How to put outputs of the print function into a textbox?

Hi everyone, how can i put the outputs of the print function used in the below code

bool compare(int absno, Object o1, o2, string attr) {
 
  string s1, s2
 
  s1 = o1.attr
  s2 = o2.attr
 
  if (s1!=s2) {
    print "object #" absno " has differing " attr "\n<\t" s1 "\n>\t" s2 "\n"
    accept o1                      // set filter
    accept o2                      // on both objects
    return false
  }
  return true
}

 


This function above is recursive so at first i thought of using an array, after i wanted to used a buffer but unfortunately the buffer i used holds only the last sentence and skips the rest.

If it is not going to be too much, i want to put a DBE into a tab strip using "inside" placement keyword, however, i guess i am doing a mistake so i get a syntax error.

I thank you in adavance for your help. Kind regards.

 


SystemAdmin - Fri May 15 09:48:13 EDT 2009

Re: How to put outputs of the print function into a textbox?
SystemAdmin - Fri May 15 09:57:08 EDT 2009

i remarked that i was not that clear about my strip question, so i decided to make it clear. actually i can put something in a tab strip, the problem is as i have three tab strips, i do not know how to put the relevant DBe to its correct tab. Because in the manual they have written only how to put a DBe into a tab however there is no trace explaining how to associate the tabs with their corresponding DBEs. Thanks one more time.

Re: How to put outputs of the print function into a textbox?
llandale - Fri May 15 11:48:01 EDT 2009

Using TABs was a nightmare for me years ago; never did it again. I don't recall everything, but you had to associate the top/bottom/left/right of each DBE with each other. Good luck. Someday I'll write some library functions to make that easier.

As for the print, you can write an overloaded function like this:

void   print(string PrintString)
{  infoBox("This string was supposed to be printed:\n" PrintString)
}

 


>Louie

 

Re: How to put outputs of the print function into a textbox?
Ron_Lewis - Fri May 15 15:18:21 EDT 2009

Normal approach is to capture each string that you wish to print into a buffer.

Then either realize a text box or set a text box with the value of the buffer. This approach is faster than a print statement.

Re: How to put outputs of the print function into a textbox?
djakad - Mon May 18 18:23:11 EDT 2009

MYigitturk,
I put together the attached DXL as an example.

A few things:
1.) You'll see how to set up tabs. You need a "ChooseTab" function that hides and shows the proper dialog box elements. Also, you need to declare DBEs in the same order that you place them in the DB.
2.) In your "compare" function, I see you are passing in "absno", but presumably that is a function of either o1 or o2. You can use o1."Absolute Number" to get the absno from within the function. In my example, I use identifier(o1), which is similar
3.) When you say "recursive", it's not entirely clear to me what you are trying to do. In my example, I run through the entire module, comparing every Object to the next Object, and showing any changes in attribute value.
4.) Be aware that the "for Object in entire(Module)" loop includes deleted objects. You can strip these out by adding another IF statement, such as "if(!isDeleted(xObject)) {// do somehting}"

Let me know if you have other questions.
Attachments

attachment_14252743_CompareAttributes.dxl

Re: How to put outputs of the print function into a textbox?
djakad - Mon May 18 18:34:31 EDT 2009

djakad - Mon May 18 18:23:11 EDT 2009
MYigitturk,
I put together the attached DXL as an example.

A few things:
1.) You'll see how to set up tabs. You need a "ChooseTab" function that hides and shows the proper dialog box elements. Also, you need to declare DBEs in the same order that you place them in the DB.
2.) In your "compare" function, I see you are passing in "absno", but presumably that is a function of either o1 or o2. You can use o1."Absolute Number" to get the absno from within the function. In my example, I use identifier(o1), which is similar
3.) When you say "recursive", it's not entirely clear to me what you are trying to do. In my example, I run through the entire module, comparing every Object to the next Object, and showing any changes in attribute value.
4.) Be aware that the "for Object in entire(Module)" loop includes deleted objects. You can strip these out by adding another IF statement, such as "if(!isDeleted(xObject)) {// do somehting}"

Let me know if you have other questions.

MYigitturk,
Please see attached DXL. I had to fix a couple things.
Attachments

attachment_14252744_CompareAttributes_FIX.dxl

Re: How to put outputs of the print function into a textbox?
SystemAdmin - Tue May 19 04:31:05 EDT 2009

djakad - Mon May 18 18:34:31 EDT 2009
MYigitturk,
Please see attached DXL. I had to fix a couple things.

Hi Djakad, first of I would like to thank you sincerely for this very detailed response. Even tough it is not exactly related with the project i am doing, i believe that i can learn a lot from your functions for other applications. Actually i think, thanks to you i have a glimpse of how to put more easily DBE elements into tab strips. I thank you one more time for your attention, and i would like to get in touch you again in case there are points that i do not get. Kind regards.

Re: How to put outputs of the print function into a textbox?
izzo - Fri Oct 01 05:17:44 EDT 2010

Hello,

My script does not print all the Object Texts, it only shows the last element put in the buffers. How can I print all the Objects Texts and their differences ?

Thanks

DB db = create "Show diff"
DBE textbox = richText(db, "Text Modification", "", 200, 200, true)
Buffer exitext = create()
Buffer exittext = create()
Buffer resBuf = create()
for loop {
exitext=obj_v1."Object Text"
exittext=obj_v2."Object Text"
diff(resBuf, exitext,exittext, "\\cf1\\strike ", "\\cf3\\ul ") }
realize db
useRTFColour(textbox, true)
set(textbox, tempStringOf resBuf)
show db
delete resBuf
delete exittext
delete exitext

Re: How to put outputs of the print function into a textbox?
Mathias Mamsch - Fri Oct 01 17:36:22 EDT 2010

izzo - Fri Oct 01 05:17:44 EDT 2010
Hello,

My script does not print all the Object Texts, it only shows the last element put in the buffers. How can I print all the Objects Texts and their differences ?

Thanks

DB db = create "Show diff"
DBE textbox = richText(db, "Text Modification", "", 200, 200, true)
Buffer exitext = create()
Buffer exittext = create()
Buffer resBuf = create()
for loop {
exitext=obj_v1."Object Text"
exittext=obj_v2."Object Text"
diff(resBuf, exitext,exittext, "\\cf1\\strike ", "\\cf3\\ul ") }
realize db
useRTFColour(textbox, true)
set(textbox, tempStringOf resBuf)
show db
delete resBuf
delete exittext
delete exitext

Dude, four suggestions:

a) use the { C O D E } statement for posting code
b) don't pull 1 year old answered threads
c) use a real name
d) visit a DXL training, OR read the fmanual of the 'show' function (put no statements below!), read the manual of the set(textfield, ...) function, which will not add something to a text field, but replace its contents.)

Mathias